package cn.wolfcode.controller;

import cn.wolfcode.pojo.Product;
import cn.wolfcode.result.Result;
import cn.wolfcode.service.ProductService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@Slf4j
@RequestMapping("/product")
@Api(tags = "商品")
public class ProductController {

    @Autowired
    ProductService productService;

    @GetMapping("/product")
    public Result<List<Product>> getProductList(){
        List<Product> list =  productService.getProductList();
        return Result.success(null,list);
    }
}
